package cn.circle.system.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
@Entity
@Table(name="ORDER_INFO")
@DynamicInsert(true)
@DynamicUpdate(true)
public class OrderInfo implements Serializable {
	
	private static final long serialVersionUID = -6399658287187165507L;
    
	
	private Long orderId;		    //订单号
	private String orderNo;
	//private Long commodityIds;		//商品编号
	private CommodityInfo commodityInfo;
	private String serialNumber;    //流水号
	private Integer orderNumber;	//订单数量
	private Double payPrice;		//支付价格
	private Byte payStatus; 		//支付状态  1.支付成功 2.未支付
	private java.sql.Timestamp payTime;			//支付时间
	private Integer payWay;			//支付方式  1.微信支付  2.货到付款
/*	private Integer userId;			//支付人
*/	//private SysDepartment sysDepartment;  
	private SysUser sysUser;
	private Byte sendStatus;		//送货状态 1.下单 2.确认3.送货4.已送到  0用户取消（未发货的订单才能）
	//private Byte flag;				//新订单提示状态 1未提示 2已提示
	private String tag;    //留言
	private String phone;    //联系
	private String address;    //送货地址
	//private String openId;    //支付人微信号
	private String nickName;    //昵称
	private String userName;    //姓名
	private Date createTime;//创建时间
	
	private  List<OrderDeatil> orderDeatil = new ArrayList<OrderDeatil>();
	

	@Id
	@Column(name = "ORDER_ID",unique = true,nullable = false)
	@GeneratedValue(strategy = GenerationType.AUTO)		//自增长
	public Long getOrderId() {
		return orderId;
	}
	public void setOrderId(Long orderId) {
		this.orderId = orderId;
	}
	@Column(name ="ORDER_NO")
	public String getOrderNo() {
		return orderNo;
	}
	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}
//	@Column(name ="COMMODITY_ID")
//	public Long getCommodityIds() {
//		return commodityIds;
//	}
//	public void setCommodityIds(Long commodityIds) {
//		this.commodityIds = commodityIds;
//	}
	@Column(name ="SERIAL_NUMBER",nullable = false)
	public String getSerialNumber() {
		return serialNumber;
	}
	public void setSerialNumber(String serialNumber) {
		this.serialNumber = serialNumber;
	}
	@Column(name ="ORDER_NUMBER")
	public Integer getOrderNumber() {
		return orderNumber;
	}
	public void setOrderNumber(Integer orderNumber) {
		this.orderNumber = orderNumber;
	}
	@Column(name="PAY_PRICE",nullable = false)
	public Double getPayPrice() {
		return payPrice;
	}
	public void setPayPrice(Double payPrice) {
		this.payPrice = payPrice;
	}
	@Column(name="PAY_STATUS",nullable = false,columnDefinition = "tinyint default 2")
	public Byte getPayStatus() {
		return payStatus;
	}
	public void setPayStatus(Byte payStatus) {
		this.payStatus = payStatus;
	}

	@Column(name = "PAY_TIME",columnDefinition = "timestamp not null default CURRENT_TIMESTAMP")
	public java.sql.Timestamp getPayTime() {
		return payTime;
	}
	public void setPayTime(java.sql.Timestamp payTime) {
		this.payTime = payTime;
	}
	@Column(name="PAY_WAY",nullable = false)
	public Integer getPayWay() {
		return payWay;
	}
	public void setPayWay(Integer payWay) {
		this.payWay = payWay;
	}
//	@Column(name="CUST_ID")
//	public Integer getCustId() {
//		return custId;
//	}
//	public void setCustId(Integer custId) {
//		this.custId = custId;
//	}
	@Column(name="SEND_STATUS",nullable = false,columnDefinition = "tinyint default 1")
	public Byte getSendStatus() {
		return sendStatus;
	}
	public void setSendStatus(Byte sendStatus) {
		this.sendStatus = sendStatus;
	}
	
	
	
	/*@Column(name = "FLAG",columnDefinition = "tinyint default 1")
	public Byte getFlag() {
		return flag;
	}
	public void setFlag(Byte flag) {
		this.flag = flag;
	}
	
	
	@ManyToOne(targetEntity = SysCustomer.class)
	@JoinColumn(name = "CUST_ID")
	public SysCustomer getSyscustomer() {
		return syscustomer;
	}
	public void setSyscustomer(SysCustomer syscustomer) {
		this.syscustomer = syscustomer;
	}*/
	
	@ManyToOne(targetEntity = CommodityInfo.class)
	@JoinColumn(name = "COMMODITY_ID")
	public CommodityInfo getCommodityInfo() {
		return commodityInfo;
	}
	public void setCommodityInfo(CommodityInfo commodityInfo) {
		this.commodityInfo = commodityInfo;
	}
	@Column(name = "TAG")
	public String getTag() {
		return tag;
	}
	public void setTag(String tag) {
		this.tag = tag;
	}

	/*@ManyToOne(targetEntity = SysDepartment.class)
	@JoinColumn(name = "DEP_ID")
	public SysDepartment getSysDepartment() {
		return sysDepartment;
	}
	public void setSysDepartment(SysDepartment sysDepartment) {
		this.sysDepartment = sysDepartment;
	}
	
	@Column(name = "TAG")
	public String getTag() {
		return tag;
	}
	public void setTag(String tag) {
		this.tag = tag;
	}
	
	/*@ManyToOne(targetEntity = SysCustomer.class)
	@JoinColumn(name = "CUST_ID")
	public SysCustomer getSyscustomer() {
		return sysuser;
	}
	public void setSyscustomer(SysCustomer syscustomer) {
		this.syssu = syscustomer;
	}*/
	@Column(name = "PHONE")
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	@Column(name = "ADDRESS")
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	/*@Column(name = "OPENID")
	public String getOpenId() {
		return openId;
	}
	public void setOpenId(String openId) {
		this.openId = openId;
	}*/
	@Column(name = "NICKNAME")
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	@Column(name = "USERNAME")
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
/*	@Column(name = "COMM_STATUS",columnDefinition = "int default 1")
	public Integer getCommStatus() {
		return commStatus;
	}
	public void setCommStatus(Integer commStatus) {
		this.commStatus = commStatus;
	}*/
	@JoinColumn(name = "USER_ID")
	@ManyToOne(targetEntity = SysUser.class)
	public SysUser getSysUser() {
		return sysUser;
	}
	public void setSysUser(SysUser sysUser) {
		this.sysUser = sysUser;
	}
	
	/*@OneToMany(cascade = CascadeType.ALL) //表示级练操作
    @JoinColumn(name = "DTL_ORDER_NO") 
	public List<OrderDeatil> getOrderDeatil() {
		return orderDeatil;
	}
	public void setOrderDeatil(List<OrderDeatil> orderDeatil) {
		this.orderDeatil = orderDeatil;
	}*/
	@Column(name = "CREATE_TIME")
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date date) {
		this.createTime = date;
	}

}